Skip to content

How to install ABINIT on macOS

This file describes how to install ABINIT on macOS using one of the following approaches:

  • Homebrew package manager
  • MacPorts package manager
  • Compilation from source

Using homebrew

Tested with:

  1. macOS 10.13 (High Sierra)
  2. macOS 10.14 (Mojave)
  3. macOS 10.15 (Catalina)

A Homebrew official formula for ABINIT is available in this github repository.

Prerequisites

Installing ABINIT

Before the first installation, type:

brew tap abinit/tap

To install ABINIT just type:

brew install abinit

and ABINIT should install smoothly with all its dependencies.

Note that:

  • the LibXC and netCDF fallbacks are enabled by default. Wannier90 and BigDFT are not available in Homebrew. AtomPAW can be installed as a separate formula.

  • the following extra options are available for the ABINIT formula:

    • –with-testsuite → Run full test suite (time consuming)
    • –without-check → Skip build-time tests (not recommended)
    • –without-openmp → Disable openMP multithreading
    • –without-netcdf → Build without netcdf support
    • –without-libxc → Build without libXC support
    • –without-fftw → Build without fftw support
    • –without-scalapack → Build without scalapack support

Using macports

ABINIT is available on the MacPorts project, but it is not necessarily the latest version. The procedure has been tested with Mac OS X v10.8 (Mountain Lion) and v10.15 (Catalina)

Prerequisites:

  1. MacPorts installed (see https://www.macports.org/install.php)

  2. Some basic ports already installed:

    1. gcc (last version) with Fortran variant (Fortran compiler),
    2. mpich or openmpi (MPI)
  3. Before starting, it is preferable to update the MacPorts system:

    sudo port selfupdate
    sudo port upgrade outdated
    

Installing ABINIT

To install ABINIT, just type:

sudo port install abinit

ABINIT port variants

By default, ABINIT is installed with libXC and Wannier90

To activate support for the FFTW3 library:

 sudo port install abinit @X.Y.Z +fftw3

To link ABINIT with the parallel Linear Algebra ScaLapack:

 sudo port install abinit @X.Y.Z +scalapack

To install a multi-threaded (openMP) version of ABINIT:

 sudo port install abinit @X.Y.Z +threads

It is possible to mix all previous variants:

sudo port install abinit @X.Y.Z +fftw3+threads+scalapack

Other options available, see:

port info abinit

Compiling from source under macOS

Prerequisites

  1. macOS

  2. Xcode installed with “Xcode command line tools”; just type:

    xcode-select --install
    
  3. A Fortran compiler installed. Possible options:

  4. Mandatory libraries.

    • HDF5 (High-performance data management and storage suite)

    • NetCDF (Network Common Data Form)

    • libXC (library of exchange-correlation functionals)
  5. A MPI library installed (if you want to benefit from parallelism; recommended). Possible options:

  6. A Linear Algebra library installed. By default the accelerate Framework is installed on macOS and the ABINIT build system should find it. But you might want to install a parallel library: scalapack, atlas, mkl, etc. If ABINIT is linked with the accelerate library, make sure the code is configured with --enable-zdot-bugfix="yes". Use otool -L abinit to print the shared libraries required by the program.

Installing ABINIT from source

For normal users it is advised to get the newest version from our website (replace 9.0.4 by the newest version available).

wget https://www.abinit.org/sites/default/files/packages/abinit-9.0.4.tar.gz
tar xzf abinit-9.0.4.tar.gz
cd abinit-9.0.4

Create a working directory:

mkdir build && cd build

To configure the sequential version, use:

../configure FC=gfortran CC=clang FCFLAGS_EXTRA="-ffree-line-length-none"

For the parallel version (only if MPI installed):

../configure FC=mpif90 CC=mpicc FCFLAGS_EXTRA="-ffree-line-length-none" \
             --enable-mpi  --enable-mpi-io

Compile with:

make -j4

Install (optional):

make install

Remember that on MacOs, the environment variant LD_LIBRARY_PATH should be replaced by DYLD_LIBRARY_PATH.

Comments

To benefit from the optional “fallbacks” (Wannier90, libPSML, …), consult the abinit-fallbacks Project